<?php

/**
 * main.php
 * This file holds the configuration settings of your backend application.
 * */
$backendConfigDir = dirname(__FILE__);

$params = require_once($backendConfigDir . DIRECTORY_SEPARATOR . 'params.php');

// Setup some default path aliases. These alias may vary from projects.
Yii::setPathOfAlias('root', ROOT);
Yii::setPathOfAlias('common', ROOT . DIRECTORY_SEPARATOR . 'common');
Yii::setPathOfAlias('backend', ROOT . DIRECTORY_SEPARATOR . 'backend');
/* uncomment if you need to use frontend folders */
/* Yii::setPathOfAlias('frontend', $root . DIRECTORY_SEPARATOR . 'frontend'); */

return array(
    'name' => 'Backend',
    // @see http://www.yiiframework.com/doc/api/1.1/CApplication#basePath-detail
    'basePath' => $backendConfigDir . DIRECTORY_SEPARATOR . '..',
    // set parameters
    'params' => $params,
    // preload components required before running applications
    // @see http://www.yiiframework.com/doc/api/1.1/CModule#preload-detail
    'preload' => array('bootstrap', 'log'),
    // @see http://www.yiiframework.com/doc/api/1.1/CApplication#language-detail
    'language' => 'en',
    // using bootstrap theme ? not needed with extension
//		'theme' => 'bootstrap',
    // setup import paths aliases
    // @see http://www.yiiframework.com/doc/api/1.1/YiiBase#import-detail
    'import' => array(
	'common.components.*',
	'common.components.helpers.*',
	//loading model
	'common.models.*',
	'common.models.user.*',
	'application.components.*',
	'application.models.*'
    ),
    'defaultController' => 'site',
    'components' => array(
	'user' => array(
	    // enable cookie-based authentication
	    'allowAutoLogin' => true,
	    'class' => 'WebUser'
	),
	/* load bootstrap components */
	'bootstrap' => array(
	    'class' => 'common.extensions.bootstrap.components.Bootstrap',
	    'coreCss' => false
	),
	'errorHandler' => array(
	// @see http://www.yiiframework.com/doc/api/1.1/CErrorHandler#errorAction-detail
	//'errorAction' => 'site/error'
	),
	'db' => $params['db.connect'],
	'urlManager' => array(
	    'urlFormat' => 'path',
	    'urlSuffix' => '',
	    'showScriptName' => false,
	    #'baseUrl' => 'http://localhost/',
	    'rules' => $params['url.rules']
	),
	'log' => array(
	    'class' => 'CLogRouter',
	    'routes' => array(
		array(
		    'class' => 'CFileLogRoute',
		    'levels' => 'error, warning',
		),
		// uncomment the following to show log messages on web pages
		array(
		    'class' => 'CWebLogRoute',
		    'levels' => 'trace, info, error, warning',
		),
	    ),
	),
	'cache' => $params['cache.file'],
	'settings' => $params['settings'],
	'image' => array(
	    'class' => 'common.extensions.image.CImageComponent',
	    // GD or ImageMagick
	    'driver' => 'GD',
	    // ImageMagick setup path
	    'params' => array('directory' => 'imagemagick directory'),
	),
    /* make sure you have your cache set correctly before uncommenting */
    /* 'cache' => $params['cache.core'], */
    /* 'contentCache' => $params['cache.content'] */
    ), //end components
    'modules' => array(
	'gii' => array(
	    'class' => 'system.gii.GiiModule',
	    'password' => false,
	    'generatorPaths' => array(
		'bootstrap.gii'
	    ),
	),
	'cms',
	'user',
	'cal',
	'calendar',
	'ad'
    )
);